/*
 * @Author: Robin
 * @Date: 2020/10/27 15:14
 * @LastEditors: Robin
 * @LastEditTime: 2020/10/27 15:14
 * @Description: MSS文件名称格式化
 */
package main

import (
	"flag"
	"fmt"
	"io/ioutil"
	"log"
	"strings"
)

func main() {
	t := flag.String("type", "app", "市场应用")
	path := flag.String("path", "", "路径")
	flag.Parse()
	files, err := ioutil.ReadDir(*path)
	if err != nil {
		log.Fatalln(err)
	}
	strs := make([]string, 0)
	switch *t {
	case "app":
		for _, f := range files {
			if strings.Contains(f.Name(), ".jpg") {
				strs = append(strs, f.Name()+","+strings.Replace(f.Name(), ".jpg", ".mp4", 1))
			}
		}
		break
	case "image":
		for _, f := range files {
			if strings.Contains(f.Name(), ".jpg") {
				strs = append(strs, f.Name())
			}
		}
		break
	}
	fmt.Println(strings.Join(strs, "#"))
}
